<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

</script>
</head>
<body>
 		<div class="page-bar">
			<ul class="page-num-ul clearfix">
				<li>共${pageSupport.totalCount}条记录&nbsp;&nbsp; ${pageSupport.currPageNo}/${pageSupport.totalPage}页</li>
                <!-- 方式1：直接通过连接跳转，弊端查询条件在form中 -->
                <%-- <a href="/users?method=userListPage&pageNo=1">首页</a>--%>
                <%-- <a href="/users?method=userListPage&pageNo=${pageSupport.currPageNo - 1}">上一页</a>--%>
                <%-- <a href="/users?method=userListPage&pageNo=${pageSupport.currPageNo + 1}">下一页</a>--%>
                <%-- <a href="/users?method=userListPage&pageNo=1${pageSupport.totalPage}">最后一页</a>--%>
                <!-- 方式2：js提交表单跳转 -->
                    <a href="javascript:do_page(1)">首页</a>
                    <a href="javascript:do_page(${pageSupport.currPageNo - 1})">上一页</a>
                    <a href="javascript:do_page(${pageSupport.currPageNo + 1})">下一页</a>
                    <a href="javascript:do_page(${pageSupport.totalPage})">最后一页</a>

			</ul>
			 <span class="page-go-form"><label>跳转至</label>
			 <input type="text" name="inputPage" id="inputPage" class="page-key" />页
			 <button type="button" class="page-btn" id="goPage" onclick="to_page()">GO</button>
			</span>
		</div>
</body>
<script type="text/javascript">
    // 翻页
    function do_page(pageNo){
        // alert(pageNo);
        // 将form表单中的页码赋值
        document.forms[0].pageNo.value = pageNo;
        document.forms[0].submit();
    }

    // 指定页跳转
	function to_page() {
		var goPageNo = document.getElementById("inputPage").value;
		if (goPageNo == null || goPageNo == ""){
			alert("请输入跳转页码！");
			return;
		}

		// 限制输入正整数内容
		var regExp = /^[1-9]\d*$/;
		if(!regExp.test(goPageNo)){
			alert("请输入正确页码！");
			return;
		}
		// alert(goPageNo);
        // 方式1：直接指定页码查询数据
		// location.href = "/users?method=userListPage&pageNo=" + goPageNo;
        // 方式2：调用翻页
        do_page(goPageNo);
	}
</script>
</html>